$OpenBSD: patch-qtwebkit_Source_JavaScriptCore_heap_MachineStackMarker_cpp,v 1.2 2015/01/10 22:02:56 zhuk Exp $
Unbreak build.
Synchronized with WebKit upsteam.
--- qtwebkit/Source/JavaScriptCore/heap/MachineStackMarker.cpp.ports.orig	Thu Sep 11 14:48:22 2014
+++ qtwebkit/Source/JavaScriptCore/heap/MachineStackMarker.cpp	Wed Jan  7 01:01:51 2015
@@ -45,6 +45,10 @@
 
 #elif OS(UNIX)
 
+#if OS(OPENBSD)
+#include<sys/param.h>
+#endif
+
 #include <sys/mman.h>
 #include <unistd.h>
 
@@ -311,6 +315,8 @@ typedef arm_thread_state_t PlatformThreadRegisters;
 typedef CONTEXT PlatformThreadRegisters;
 #elif OS(QNX)
 typedef struct _debug_thread_info PlatformThreadRegisters;
+#elif OS(OPENBSD)
+typedef pthread_t PlatformThreadRegisters;
 #elif USE(PTHREADS)
 typedef pthread_attr_t PlatformThreadRegisters;
 #else
@@ -369,6 +375,8 @@ static size_t getPlatformThreadRegisters(const Platfor
     }
     close(fd);
     return sizeof(struct _debug_thread_info);
+#elif OS(OPENBSD)
+    regs = platformThread;
 #elif USE(PTHREADS)
     pthread_attr_init(&regs);
 #if HAVE(PTHREAD_NP_H) || OS(NETBSD)
@@ -437,7 +445,14 @@ static inline void* otherThreadStackPointer(const Plat
 #elif USE(PTHREADS)
     void* stackBase = 0;
     size_t stackSize = 0;
+#if OS(OPENBSD)
+    stack_t ss;
+    int rc = pthread_stackseg_np(regs, &ss);
+    stackBase = (void*)((size_t) ss.ss_sp - ss.ss_size);
+    stackSize = ss.ss_size;
+#else
     int rc = pthread_attr_getstack(&regs, &stackBase, &stackSize);
+#endif
     (void)rc; // FIXME: Deal with error code somehow? Seems fatal.
     ASSERT(stackBase);
     return static_cast<char*>(stackBase) + stackSize;
@@ -448,7 +463,7 @@ static inline void* otherThreadStackPointer(const Plat
 
 static void freePlatformThreadRegisters(PlatformThreadRegisters& regs)
 {
-#if USE(PTHREADS) && !OS(WINDOWS) && !OS(DARWIN) && !OS(QNX)
+#if USE(PTHREADS) && !OS(WINDOWS) && !OS(DARWIN) && !OS(QNX) && !OS(OPENBSD)
     pthread_attr_destroy(&regs);
 #else
     UNUSED_PARAM(regs);
